<template>
    <div class="MyTable">
            <el-table :data="tableData" border style="width: 100%" >
           <el-table-column :prop="item.name" :label="item.title" :type="item.type"  v-for="(item,index) in Data" :key="index">
             <template v-slot="{row,index}" v-if="item.slot">
               
               <slot :name="item.slot" :row="row" :index="index"></slot>
            </template>
           </el-table-column>
            </el-table>

      <!-- 分页 -->
      <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="page.pagenum"
      :page-sizes="[3, 5, 10, 20]"
      :page-size="page.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
     </el-pagination>
    </div>
</template>
<script>
export default {
    name:"MyTable",
    props:{
        tableData:{
            type:Array,
            required:true,
            default:()=>[],
        },
        Data:{
            type:Array,
            required:true,
            default:()=>[],
        },
       total:{
        type:Number,
        required:true,
       },
       page:{
        type:Object,
        required:true,
        default:()=>{}
       }
    },
    methods: {
        handleSizeChange(val){
            this.$emit('handleSizeChange',val )
        },
        handleCurrentChange(val){
            this.$emit('handleCurrentChange',val )
        }
    },
}
</script>
